package com.phonetools.commonutils.android.hardware

import android.content.Context
import android.net.wifi.WifiManager

/**
 * Wifi开关是否启用
 * @return Boolean
 */
fun isWifiEnable(context: Context): Boolean {
    var result = false
    val wifiManager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
    val state = wifiManager.wifiState
    if (state == WifiManager.WIFI_STATE_ENABLED || state == WifiManager.WIFI_STATE_ENABLING) {
        result = true
    }
    return result
}